package week4;
import java.util.*;

public class hanshuti {
	public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    
	    int n=Integer.parseInt(sc.next());
		String[] b= new String[n];
		for (int i = 0; i < n; i++) {
			switch(sc.next()){
			case "c":
				Computer C = new Computer();
				b[i] = C.toString();
				break;
			case "d":
				Double D = new Double(sc.next());
				b[i] = D.toString();
				break;
			case "i":
				Integer I = new Integer(sc.next());
				b[i] = I.toString();
				break;
			case "s":
				String S = new String(sc.next());
				b[i] = S;
				break;
			default:
				b[i] = "null";
				break;
				
			}
		}
		for (int i = n-1; i >= 0; i--) {
			if(!b[i].equals("null"))
				System.out.println(b[i]);
			
		}

	    
	    sc.close();
	}



public boolean equals(Object obj) {
	if (this == obj)
		return true;
	if (!super.equals(obj))
		return false;
	if (getClass() != obj.getClass())
		return false;
	Employee other = (Employee) obj;
	if (company == null) {
		if (other.company != null)
			return false;
	} else if (!company.equals(other.company))
		return false;
	DecimalFormat df = new DecimalFormat("#.##");
	String a = df.format(this.salary);
	double a1 = Double.parseDouble(a);
	String b = df.format(other.salary);
	double b1 = Double.parseDouble(b);
	if (a1 != b1)
		return false;
	return true;
}














